package nl.mayisal.metadata;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import nl.mayisal.metadata.columns.AbstractColumnStructure;

public class TableStructure {
	private final HashMap<String,AbstractColumnStructure<?>> columns = new HashMap<String,AbstractColumnStructure<?>>();
	private final HashMap<String,TableRelation> relations = new HashMap<String,TableRelation>();
	private final String name;
	private int recordCount = -1;
	
	public TableStructure(String name) {
		this.name = name;
	}
	public void addColumn(String key, AbstractColumnStructure<?> column) {
		this.columns.put(key,column);
	}
	public String getName() {
		return this.name;
	}
	public void setRecordCount(int recordCount) {
		this.recordCount = recordCount;
	}
	public int getRecordCount() {
		return this.recordCount;
	}
	public void addRelation(String columnName, TableRelation relation) {
		this.relations.put(columnName, relation);
	}
	public Map<String,TableRelation> getRelations() {
		return Collections.unmodifiableMap(this.relations);
	}
	public AbstractColumnStructure<?> getColumn(String columnName) {
		return this.columns.get(columnName);
	}

}
